import { Context, Next } from 'koa';

export const errorHandler = async (ctx: Context, next: Next) => {
    try {
        await next();
    } catch (err) {
        console.log(err);
        ctx.status = 500;
        ctx.body = { error: 'Internal Server Error' };
    }
};